<template>
  <div id="shop-info">
    <div class="shop-top">
      <img :src="shop.shopLogo" alt="">
      <span class="shop-name">{{shop.name}}</span>
    </div>
    <div class="shop-center">
      <div class="center-left center-common" >
        <div class="info-sells">
          <div>{{cSells}}</div>
          <div>总销量</div>
        </div>
        <div class="info-goods">
          <div>{{shop.cGoods}}</div>
          <div>全部宝贝</div>
        </div>
      </div>
      <div class="center-right center-common">
        <table>
          <tr v-for="(item, index) in shop.score" :key="index">
            <td>{{item.name}}</td>
            <td class="islow" :class="{isbetter:item.isBetter}">{{item.score}}</td>
            <td class="islow" :class="{isbetter:item.isBetter}">{{item.isBetter ? '高' : '低'}}</td>
          </tr>
        </table>
      </div>
    </div>
    <div class="shop-bottom">
      <div class="enter-shop">进店逛逛</div>
    </div>
  </div>
</template>

<script>
  export default {
    name: "DetailShopInfo",
    props:{
      shop:{
        type:Object,
        default(){
          return {}
        }
      }
    },
    computed:{
      cSells(){
        if(this.shop.cSells < 10000)return this.shop.cSells;
        return (this.shop.cSells/10000).toFixed(1) + '万'
      }
    },
  }
</script>

<style scoped>
  #shop-info{
    padding: 25px 8px;
    border-bottom: 5px solid #f2f5f8;
  }
  .shop-top{
    padding: 5px 0;
    display: flex;
    /*img已经撑高了不用给父元素设置高度*/
    align-items: center;
  }
  .shop-name{
    font-size: 13px;
    margin-left: 3px;
  }
  .shop-top img{
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,.1);
  }
  .shop-center{
    display: flex;
  }
  .center-common{
    flex: 1;
    text-align: center;
  }
  .center-left{
    display: flex;
    justify-content: space-evenly;
    margin-top: 15px;
    border-right: 1px solid rgba(0,0,0,.1);
  }
  .info-sells,.info-goods{
    margin-top: 10px;
  }
  .center-right table{
    margin-left: 30px;
    font-size: 14px;
  }
  td{
    padding:5px 0;
  }
  .islow{
    color: red;
  }
  .isbetter{
    color: #40dc3a;
  }
  .shop-bottom{
    margin: 20px 0;
    display: flex;
    justify-content: center;
  }
  .enter-shop{
    background-color: #f2f5f8;
    width: 120px;
    height: 30px;
    text-align: center;
    line-height: 30px;
    border-radius: 10px;
    font-size: 14px;
  }
</style>